<!DOCTYPE html>












  


<html class="theme-next gemini use-motion" lang="Chinese">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2"/>
<meta name="theme-color" content="#222">












<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />






















<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=6.4.0" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=6.4.0">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=6.4.0">


  <link rel="mask-icon" href="/images/logo.svg?v=6.4.0" color="#222">









<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '6.4.0',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: false,
    fastclick: false,
    lazyload: false,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>


  




  <meta name="description" content="安装SVN检查是否安装rpm -qa subversion 卸载旧版本yum remove subversion 安装最新版本yum install subversion 检查是否安装成功svnserve –version （–之后一般跟选项的完整名称，-之后一般跟选项的单个字母缩写） 创建项目仓库创建目录mkdir -p /var/svn/svnrepos (-p命令是当父目录不存在时创建它）">
<meta name="keywords" content="CentOS,SVN">
<meta property="og:type" content="article">
<meta property="og:title" content="在CentOS下搭建一个适用于个人的SVN环境">
<meta property="og:url" content="http://blog.zhengzi.me/2015/12/27/e6-90-ad-e5-bb-ba-e4-b8-80-e4-b8-aa-e9-80-82-e7-94-a8-e4-ba-8e-e4-b8-aa-e4-ba-ba-e5-8d-9a-e5-ae-a2-e7-9a-84svn-e6-9c-8d-e5-8a-a1-2/index.html">
<meta property="og:site_name" content="政子的博客">
<meta property="og:description" content="安装SVN检查是否安装rpm -qa subversion 卸载旧版本yum remove subversion 安装最新版本yum install subversion 检查是否安装成功svnserve –version （–之后一般跟选项的完整名称，-之后一般跟选项的单个字母缩写） 创建项目仓库创建目录mkdir -p /var/svn/svnrepos (-p命令是当父目录不存在时创建它）">
<meta property="og:locale" content="Chinese">
<meta property="og:updated_time" content="2018-08-21T09:49:42.773Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="在CentOS下搭建一个适用于个人的SVN环境">
<meta name="twitter:description" content="安装SVN检查是否安装rpm -qa subversion 卸载旧版本yum remove subversion 安装最新版本yum install subversion 检查是否安装成功svnserve –version （–之后一般跟选项的完整名称，-之后一般跟选项的单个字母缩写） 创建项目仓库创建目录mkdir -p /var/svn/svnrepos (-p命令是当父目录不存在时创建它）">






  <link rel="canonical" href="http://blog.zhengzi.me/2015/12/27/e6-90-ad-e5-bb-ba-e4-b8-80-e4-b8-aa-e9-80-82-e7-94-a8-e4-ba-8e-e4-b8-aa-e4-ba-ba-e5-8d-9a-e5-ae-a2-e7-9a-84svn-e6-9c-8d-e5-8a-a1-2/"/>



<script type="text/javascript" id="page.configurations">
  CONFIG.page = {
    sidebar: "",
  };
</script>

  <title>在CentOS下搭建一个适用于个人的SVN环境 | 政子的博客</title>
  









  <noscript>
  <style type="text/css">
    .use-motion .motion-element,
    .use-motion .brand,
    .use-motion .menu-item,
    .sidebar-inner,
    .use-motion .post-block,
    .use-motion .pagination,
    .use-motion .comments,
    .use-motion .post-header,
    .use-motion .post-body,
    .use-motion .collection-title { opacity: initial; }

    .use-motion .logo,
    .use-motion .site-title,
    .use-motion .site-subtitle {
      opacity: initial;
      top: initial;
    }

    .use-motion {
      .logo-line-before i { left: initial; }
      .logo-line-after i { right: initial; }
    }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="Chinese">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">政子的博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
    
      
        <p class="site-subtitle">强迫症|学习者|伪文青</p>
      
    
  </div>

  <div class="site-nav-toggle">
    <button aria-label="Toggle navigation bar">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>



<nav class="site-nav">
  
    <ul id="menu" class="menu">
      
        
        
        
          
          <li class="menu-item menu-item-home">
    <a href="/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-home"></i> <br />Home</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-about">
    <a href="/about/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-user"></i> <br />About</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-tags">
    <a href="/tags/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />Tags</a>
  </li>
        
        
        
          
          <li class="menu-item menu-item-archives">
    <a href="/archives/" rel="section">
      <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />Archives</a>
  </li>

      
      
    </ul>
  

  

  
</nav>



  



</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          
            

          
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://blog.zhengzi.me/2015/12/27/e6-90-ad-e5-bb-ba-e4-b8-80-e4-b8-aa-e9-80-82-e7-94-a8-e4-ba-8e-e4-b8-aa-e4-ba-ba-e5-8d-9a-e5-ae-a2-e7-9a-84svn-e6-9c-8d-e5-8a-a1-2/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="Jason Bian">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="政子的博客">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">在CentOS下搭建一个适用于个人的SVN环境
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">

            
            
            

            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">Posted on</span>
              

              
                
              

              <time title="Created: 2015-12-27 02:55:00" itemprop="dateCreated datePublished" datetime="2015-12-27T02:55:00+08:00">2015-12-27</time>
            

            
              

              
                
                <span class="post-meta-divider">|</span>
                

                <span class="post-meta-item-icon">
                  <i class="fa fa-calendar-check-o"></i>
                </span>
                
                  <span class="post-meta-item-text">Edited on</span>
                
                <time title="Modified: 2018-08-21 17:49:42" itemprop="dateModified" datetime="2018-08-21T17:49:42+08:00">2018-08-21</time>
              
            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">In</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/Linux/" itemprop="url" rel="index"><span itemprop="name">Linux</span></a></span>

                
                
              
            </span>
          

          
            
          

          
          

          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h2 id="安装SVN"><a href="#安装SVN" class="headerlink" title="安装SVN"></a>安装SVN</h2><h3 id="检查是否安装"><a href="#检查是否安装" class="headerlink" title="检查是否安装"></a>检查是否安装</h3><p>rpm -qa subversion</p>
<h3 id="卸载旧版本"><a href="#卸载旧版本" class="headerlink" title="卸载旧版本"></a>卸载旧版本</h3><p>yum remove subversion</p>
<h3 id="安装最新版本"><a href="#安装最新版本" class="headerlink" title="安装最新版本"></a>安装最新版本</h3><p>yum install subversion</p>
<h3 id="检查是否安装成功"><a href="#检查是否安装成功" class="headerlink" title="检查是否安装成功"></a>检查是否安装成功</h3><p>svnserve –version</p>
<p>（–之后一般跟选项的完整名称，-之后一般跟选项的单个字母缩写）</p>
<h2 id="创建项目仓库"><a href="#创建项目仓库" class="headerlink" title="创建项目仓库"></a>创建项目仓库</h2><h3 id="创建目录"><a href="#创建目录" class="headerlink" title="创建目录"></a>创建目录</h3><p>mkdir -p /var/svn/svnrepos</p>
<p>(-p命令是当父目录不存在时创建它）</p>
<h3 id="创建项目仓库-1"><a href="#创建项目仓库-1" class="headerlink" title="创建项目仓库"></a>创建项目仓库</h3><p>svnadmin create /var/svn/svnrepos</p>
<h3 id="检查是否创建成功"><a href="#检查是否创建成功" class="headerlink" title="检查是否创建成功"></a>检查是否创建成功</h3><p>cd /var/svn/svnrepos</p>
<p>之后使用ll查看是否多了一些文件夹（如果成功）  </p>
<h2 id="配置项目库"><a href="#配置项目库" class="headerlink" title="配置项目库"></a>配置项目库</h2><h3 id="进入conf目录，了解配置文件："><a href="#进入conf目录，了解配置文件：" class="headerlink" title="进入conf目录，了解配置文件："></a>进入conf目录，了解配置文件：</h3><p>authz是权限控制文件 passwd是账号密码文件 svnserve.conf是SVN服务配置文件</p>
<h3 id="配置passwd"><a href="#配置passwd" class="headerlink" title="配置passwd"></a>配置passwd</h3><p>根据users标签中的提示进行配置即可，等号左边是用户名，右边是密码</p>
<h3 id="配置authz"><a href="#配置authz" class="headerlink" title="配置authz"></a>配置authz</h3><p>只有自己用，所以只是限定自己的用户有rw权限即可，在文末加入用户名和读写权限就可以了</p>
<p>#example<br>[/]<br>abc(your username) = rw</p>
<h3 id="配置svnserve-conf"><a href="#配置svnserve-conf" class="headerlink" title="配置svnserve.conf"></a>配置svnserve.conf</h3><p>anon-access = none # 使非授权用户无法访问<br>auth-access = write # 使授权用户有写权限<br>password-db = password<br>authz-db = authz # 访问控制文件<br>realm = imagine’s svn server # 认证命名空间，subversion会在认证提示里显示，并且作为凭证缓存的关键字。</p>
<p>采用默认配置. 以上语句都必须顶格写, 左侧不能留空格, 否则会出错.</p>
<h2 id="开放SVN端口"><a href="#开放SVN端口" class="headerlink" title="开放SVN端口"></a>开放SVN端口</h2><h3 id="修改iptables"><a href="#修改iptables" class="headerlink" title="修改iptables"></a>修改iptables</h3><p>iptables -I INPUT -p tcp –dport 3690 -j ACCEPT</p>
<h3 id="保存iptables配置"><a href="#保存iptables配置" class="headerlink" title="保存iptables配置"></a>保存iptables配置</h3><p>/etc/rc.d/init.d/iptables save</p>
<h3 id="重启iptables"><a href="#重启iptables" class="headerlink" title="重启iptables"></a>重启iptables</h3><p>service iptables restart</p>
<h3 id="查看iptables状态"><a href="#查看iptables状态" class="headerlink" title="查看iptables状态"></a>查看iptables状态</h3><p>/etc/init.d/iptables status</p>
<h2 id="启动SVN服务"><a href="#启动SVN服务" class="headerlink" title="启动SVN服务"></a>启动SVN服务</h2><p>svnserve -d -r /var/svn/svnrepos</p>
<p>-d:守护进程  -r:svn根目录</p>
<h2 id="连接SVN"><a href="#连接SVN" class="headerlink" title="连接SVN"></a>连接SVN</h2><p>使用TortioseSVN连接到svn://我的ip地址/ 输入前面设置的用户名密码即可访问</p>
<h2 id="配置开机启动"><a href="#配置开机启动" class="headerlink" title="配置开机启动"></a>配置开机启动</h2><p>编写脚本svn_startup.sh，放在/root/svn_startup.sh，代码如下</p>
<p>#!/bin/bash<br>export LC_CTYPE=”zh_CN.UTF-8”<br>/usr/bin/svnserve -d -r /var/svn/svnrepos</p>
<p>（关于绝对路径：在启动的时候环境变量可能没有加载，所以采用绝对路径比较保险，可以使用 which svnserve命令来查询绝对路径）</p>
<h3 id="修改脚本权限"><a href="#修改脚本权限" class="headerlink" title="修改脚本权限"></a>修改脚本权限</h3><p>chmod ug+x svn_startup.sh</p>
<p>或者</p>
<p>chmod 777 svn_startup.sh</p>
<h3 id="添加自启动"><a href="#添加自启动" class="headerlink" title="添加自启动"></a>添加自启动</h3><p>vim /etc/rc.d/rc.local</p>
<p>在文件末尾添加命令行脚本</p>
<p>/root/svn_startup.sh</p>
<h3 id="重启之后确认启动成功"><a href="#重启之后确认启动成功" class="headerlink" title="重启之后确认启动成功"></a>重启之后确认启动成功</h3><p>ps -ef|grep svnserve</p>
<h2 id="checkout-网站工作目录"><a href="#checkout-网站工作目录" class="headerlink" title="checkout 网站工作目录"></a>checkout 网站工作目录</h2><p>svn co svn://localhost /var/www/html/ –username user –password passwd</p>
<h2 id="使得SVN可以自动同步网站代码"><a href="#使得SVN可以自动同步网站代码" class="headerlink" title="使得SVN可以自动同步网站代码"></a>使得SVN可以自动同步网站代码</h2><h3 id="将工作目录转移到钩子文件夹"><a href="#将工作目录转移到钩子文件夹" class="headerlink" title="将工作目录转移到钩子文件夹"></a>将工作目录转移到钩子文件夹</h3><p>cd /var/svn/svnrepos/hooks</p>
<h3 id="添加配置文件"><a href="#添加配置文件" class="headerlink" title="添加配置文件"></a>添加配置文件</h3><p>cp post-commit.tmpl post-commit<br>chmod 777 post-commit</p>
<h3 id="修改-post-commit文件，加入以下代码"><a href="#修改-post-commit文件，加入以下代码" class="headerlink" title="修改 post-commit文件，加入以下代码"></a>修改 post-commit文件，加入以下代码</h3><p>export LANG=zh.CN.UTF-8<br>cd /var/www/html/<br>/usr/bin/svn update –username usrname –password passwd –no-auth-cache<br>echo `date`,`whoami`,$REPOS,$REV &gt;&gt;/var/svn/svnrepos/hooks/svn_hook.log</p>
<h2 id="SVN同步时注意"><a href="#SVN同步时注意" class="headerlink" title="SVN同步时注意"></a>SVN同步时注意</h2><h3 id="工作目录需要先checkout-前面已经checkout过了"><a href="#工作目录需要先checkout-前面已经checkout过了" class="headerlink" title="工作目录需要先checkout(前面已经checkout过了)"></a>工作目录需要先checkout(前面已经checkout过了)</h3><p>先切换到工作目录 再用SVN的co或者checkout命令进行checkout</p>
<h3 id="如果工作目录有更改，需要commit"><a href="#如果工作目录有更改，需要commit" class="headerlink" title="如果工作目录有更改，需要commit"></a>如果工作目录有更改，需要commit</h3><p>先切换到工作目录 再用SVN的commit或者ci命令进行同步 可能需要—message或者-m参数，后面跟上这次修改的一些信息即可</p>
<h3 id="如果工作目录中有新的文件，需要先添加到SVN中在同步"><a href="#如果工作目录中有新的文件，需要先添加到SVN中在同步" class="headerlink" title="如果工作目录中有新的文件，需要先添加到SVN中在同步"></a>如果工作目录中有新的文件，需要先添加到SVN中在同步</h3><p>使用SVN的add命令进行添加文件或者文件夹 如果需要添加的文件很多，可以使用Linux的 <em>通配符： svn add </em>/*</p>
<h3 id="批量添加-删除SVN同步的文件"><a href="#批量添加-删除SVN同步的文件" class="headerlink" title="批量添加/删除SVN同步的文件"></a>批量添加/删除SVN同步的文件</h3><p>使用bash命令</p>
<h4 id="添加"><a href="#添加" class="headerlink" title="添加"></a>添加</h4><p>svn status|grep ? |awk ‘{print $2}’|xargs svn add</p>
<h4 id="删除"><a href="#删除" class="headerlink" title="删除"></a>删除</h4><p>svn status|grep ! |awk ‘{print $2}’|xargs svn del</p>
<p>（转自：<a href="http://blog.csdn.net/ownfire/article/details/7930370" target="_blank" rel="noopener">http://blog.csdn.net/ownfire/article/details/7930370</a>） 可以添加到PATH中，如/usr/local/bin，命令叫做svnaddall和svndelall</p>
<h3 id="如果SVN同步目录中出现中文，钩子无法正常运行需要修改系统的locale"><a href="#如果SVN同步目录中出现中文，钩子无法正常运行需要修改系统的locale" class="headerlink" title="如果SVN同步目录中出现中文，钩子无法正常运行需要修改系统的locale"></a>如果SVN同步目录中出现中文，钩子无法正常运行需要修改系统的locale</h3><p>export LC_CTYPE=”zh_CN.UTF-8”</p>
<p>之后可以用locale命令检查 （添加locale的命令已经包含在自启动文件中了）</p>

      
    </div>

    

    
    
    

    

    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/CentOS/" rel="tag"># CentOS</a>
          
            <a href="/tags/SVN/" rel="tag"># SVN</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/11/21/e5-88-9b-e6-96-b0-e5-b0-8f-e6-84-9f/" rel="next" title="创新小感">
                <i class="fa fa-chevron-left"></i> 创新小感
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/12/27/apache-e4-b8-8b-e5-ad-90-e5-9f-9f-e5-90-8d-e8-ae-be-e7-bd-ae-e6-96-b9-e6-b3-95/" rel="prev" title="Apache下子域名设置方法">
                Apache下子域名设置方法 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>


  </div>


          </div>
          

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            Table of Contents
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            Overview
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="Jason Bian" />
            
              <p class="site-author-name" itemprop="name">Jason Bian</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          
            <nav class="site-state motion-element">
              
                <div class="site-state-item site-state-posts">
                
                  <a href="/archives/">
                
                    <span class="site-state-item-count">86</span>
                    <span class="site-state-item-name">posts</span>
                  </a>
                </div>
              

              
                
                
                <div class="site-state-item site-state-categories">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">41</span>
                    <span class="site-state-item-name">categories</span>
                  
                </div>
              

              
                
                
                <div class="site-state-item site-state-tags">
                  
                    
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                      
                    
                    <span class="site-state-item-count">109</span>
                    <span class="site-state-item-name">tags</span>
                  
                </div>
              
            </nav>
          

          

          

          
          

          
          

          
            
          
          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#安装SVN"><span class="nav-number">1.</span> <span class="nav-text">安装SVN</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#检查是否安装"><span class="nav-number">1.1.</span> <span class="nav-text">检查是否安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#卸载旧版本"><span class="nav-number">1.2.</span> <span class="nav-text">卸载旧版本</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#安装最新版本"><span class="nav-number">1.3.</span> <span class="nav-text">安装最新版本</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#检查是否安装成功"><span class="nav-number">1.4.</span> <span class="nav-text">检查是否安装成功</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#创建项目仓库"><span class="nav-number">2.</span> <span class="nav-text">创建项目仓库</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#创建目录"><span class="nav-number">2.1.</span> <span class="nav-text">创建目录</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#创建项目仓库-1"><span class="nav-number">2.2.</span> <span class="nav-text">创建项目仓库</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#检查是否创建成功"><span class="nav-number">2.3.</span> <span class="nav-text">检查是否创建成功</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置项目库"><span class="nav-number">3.</span> <span class="nav-text">配置项目库</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#进入conf目录，了解配置文件："><span class="nav-number">3.1.</span> <span class="nav-text">进入conf目录，了解配置文件：</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置passwd"><span class="nav-number">3.2.</span> <span class="nav-text">配置passwd</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置authz"><span class="nav-number">3.3.</span> <span class="nav-text">配置authz</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#配置svnserve-conf"><span class="nav-number">3.4.</span> <span class="nav-text">配置svnserve.conf</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#开放SVN端口"><span class="nav-number">4.</span> <span class="nav-text">开放SVN端口</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#修改iptables"><span class="nav-number">4.1.</span> <span class="nav-text">修改iptables</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#保存iptables配置"><span class="nav-number">4.2.</span> <span class="nav-text">保存iptables配置</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#重启iptables"><span class="nav-number">4.3.</span> <span class="nav-text">重启iptables</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#查看iptables状态"><span class="nav-number">4.4.</span> <span class="nav-text">查看iptables状态</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#启动SVN服务"><span class="nav-number">5.</span> <span class="nav-text">启动SVN服务</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#连接SVN"><span class="nav-number">6.</span> <span class="nav-text">连接SVN</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#配置开机启动"><span class="nav-number">7.</span> <span class="nav-text">配置开机启动</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#修改脚本权限"><span class="nav-number">7.1.</span> <span class="nav-text">修改脚本权限</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#添加自启动"><span class="nav-number">7.2.</span> <span class="nav-text">添加自启动</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#重启之后确认启动成功"><span class="nav-number">7.3.</span> <span class="nav-text">重启之后确认启动成功</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#checkout-网站工作目录"><span class="nav-number">8.</span> <span class="nav-text">checkout 网站工作目录</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#使得SVN可以自动同步网站代码"><span class="nav-number">9.</span> <span class="nav-text">使得SVN可以自动同步网站代码</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#将工作目录转移到钩子文件夹"><span class="nav-number">9.1.</span> <span class="nav-text">将工作目录转移到钩子文件夹</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#添加配置文件"><span class="nav-number">9.2.</span> <span class="nav-text">添加配置文件</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#修改-post-commit文件，加入以下代码"><span class="nav-number">9.3.</span> <span class="nav-text">修改 post-commit文件，加入以下代码</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#SVN同步时注意"><span class="nav-number">10.</span> <span class="nav-text">SVN同步时注意</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#工作目录需要先checkout-前面已经checkout过了"><span class="nav-number">10.1.</span> <span class="nav-text">工作目录需要先checkout(前面已经checkout过了)</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#如果工作目录有更改，需要commit"><span class="nav-number">10.2.</span> <span class="nav-text">如果工作目录有更改，需要commit</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#如果工作目录中有新的文件，需要先添加到SVN中在同步"><span class="nav-number">10.3.</span> <span class="nav-text">如果工作目录中有新的文件，需要先添加到SVN中在同步</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#批量添加-删除SVN同步的文件"><span class="nav-number">10.4.</span> <span class="nav-text">批量添加/删除SVN同步的文件</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#添加"><span class="nav-number">10.4.1.</span> <span class="nav-text">添加</span></a></li><li class="nav-item nav-level-4"><a class="nav-link" href="#删除"><span class="nav-number">10.4.2.</span> <span class="nav-text">删除</span></a></li></ol></li><li class="nav-item nav-level-3"><a class="nav-link" href="#如果SVN同步目录中出现中文，钩子无法正常运行需要修改系统的locale"><span class="nav-number">10.5.</span> <span class="nav-text">如果SVN同步目录中出现中文，钩子无法正常运行需要修改系统的locale</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2018</span>
  <span class="with-love" id="animate">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Jason Bian</span>

  

  
</div>




  <div class="powered-by">Powered by <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a></div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">Theme – <a class="theme-link" target="_blank" href="https://theme-next.org">NexT.Gemini</a></div>




        








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    
	
    

    
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>


























  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=6.4.0"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=6.4.0"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=6.4.0"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=6.4.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=6.4.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=6.4.0"></script>



  



  










  





  

  

  

  

  
  

  

  

  

  

  

</body>
</html>
